﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Mes.Application.Web.Migrations
{
    /// <inheritdoc />
    public partial class addall : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "attr",
                columns: table => new
                {
                    attr_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    predefined = table.Column<bool>(type: "boolean", nullable: false),
                    data_type = table.Column<int>(type: "integer", nullable: false),
                    attr_desc = table.Column<string>(type: "text", nullable: false),
                    attr_grp = table.Column<int>(type: "integer", nullable: false),
                    filtr = table.Column<string>(type: "text", nullable: true),
                    entry_type = table.Column<int>(type: "integer", nullable: false),
                    visible_in_queue = table.Column<bool>(type: "boolean", nullable: false),
                    visible_in_inv = table.Column<bool>(type: "boolean", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_attr", x => x.attr_id);
                });

            migrationBuilder.CreateTable(
                name: "bom_item_oper_link",
                columns: table => new
                {
                    parent_item_id = table.Column<string>(type: "text", nullable: false),
                    ver_id = table.Column<int>(type: "integer", nullable: false),
                    bom_pos = table.Column<int>(type: "integer", nullable: false),
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    qty_per_parent_item = table.Column<double>(type: "double precision", nullable: false),
                    reqd_start_pct = table.Column<double>(type: "double precision", nullable: false),
                    def_reas_cd = table.Column<int>(type: "integer", nullable: true),
                    def_lot_no = table.Column<string>(type: "text", nullable: true),
                    def_sublot_no = table.Column<string>(type: "text", nullable: true),
                    def_storage_ent_id = table.Column<int>(type: "integer", nullable: true),
                    def_reject_ent_id = table.Column<int>(type: "integer", nullable: true),
                    update_inv = table.Column<bool>(type: "boolean", nullable: false),
                    backflush = table.Column<bool>(type: "boolean", nullable: false),
                    must_consume_from_inv = table.Column<bool>(type: "boolean", nullable: false),
                    may_choose_alt_inv_loc = table.Column<bool>(type: "boolean", nullable: false),
                    may_create_new_lots = table.Column<bool>(type: "boolean", nullable: false),
                    must_consume_from_wip = table.Column<bool>(type: "boolean", nullable: false),
                    must_consume_before_prod = table.Column<bool>(type: "boolean", nullable: false),
                    constant_qty = table.Column<bool>(type: "boolean", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_bom_item_oper_link", x => new { x.parent_item_id, x.ver_id, x.bom_pos, x.process_id, x.oper_id });
                });

            migrationBuilder.CreateTable(
                name: "bom_item_oper_step_link",
                columns: table => new
                {
                    parent_item_id = table.Column<string>(type: "text", nullable: false),
                    ver_id = table.Column<int>(type: "integer", nullable: false),
                    bom_pos = table.Column<int>(type: "integer", nullable: false),
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    qty_per_parent_item = table.Column<double>(type: "double precision", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_bom_item_oper_step_link", x => new { x.parent_item_id, x.ver_id, x.bom_pos, x.process_id, x.oper_id, x.step_no, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "characteristic",
                columns: table => new
                {
                    char_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    char_name = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    char_desc = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    type = table.Column<int>(type: "integer", nullable: false),
                    uom_id = table.Column<int>(type: "integer", nullable: false),
                    severity_cd = table.Column<int>(type: "integer", nullable: false),
                    default_chart = table.Column<int>(type: "integer", nullable: false),
                    automated_coll = table.Column<bool>(type: "boolean", nullable: false),
                    time_interval = table.Column<int>(type: "integer", nullable: true),
                    time_int_unit = table.Column<int>(type: "integer", nullable: true),
                    num_decimals = table.Column<int>(type: "integer", nullable: false),
                    sample_size_source = table.Column<int>(type: "integer", nullable: true),
                    normal_sample_size = table.Column<int>(type: "integer", nullable: false),
                    minimum_sample_size = table.Column<int>(type: "integer", nullable: false),
                    maximum_sample_size = table.Column<int>(type: "integer", nullable: true),
                    num_defect_opp = table.Column<int>(type: "integer", nullable: true),
                    mov_avg_span = table.Column<int>(type: "integer", nullable: true),
                    sigma_est = table.Column<int>(type: "integer", nullable: true),
                    trend_limits = table.Column<bool>(type: "boolean", nullable: false),
                    use_std_err = table.Column<bool>(type: "boolean", nullable: false),
                    cl_source = table.Column<int>(type: "integer", nullable: true),
                    samples_for_cl = table.Column<int>(type: "integer", nullable: true),
                    samples_before_cl = table.Column<int>(type: "integer", nullable: false),
                    std_avg = table.Column<float>(type: "real", nullable: true),
                    std_avg_is_target = table.Column<bool>(type: "boolean", nullable: false),
                    std_deviation = table.Column<float>(type: "real", nullable: true),
                    cl_xbar = table.Column<float>(type: "real", nullable: true),
                    lcl_xbar = table.Column<float>(type: "real", nullable: true),
                    ucl_xbar = table.Column<float>(type: "real", nullable: true),
                    cl_range = table.Column<float>(type: "real", nullable: true),
                    lcl_range = table.Column<float>(type: "real", nullable: true),
                    ucl_range = table.Column<float>(type: "real", nullable: true),
                    cl_sigma = table.Column<float>(type: "real", nullable: true),
                    lcl_sigma = table.Column<float>(type: "real", nullable: true),
                    ucl_sigma = table.Column<float>(type: "real", nullable: true),
                    cl_ix = table.Column<float>(type: "real", nullable: true),
                    lcl_ix = table.Column<float>(type: "real", nullable: true),
                    ucl_ix = table.Column<float>(type: "real", nullable: true),
                    cl_imr = table.Column<float>(type: "real", nullable: true),
                    lcl_imr = table.Column<float>(type: "real", nullable: true),
                    ucl_imr = table.Column<float>(type: "real", nullable: true),
                    cl_ma = table.Column<float>(type: "real", nullable: true),
                    lcl_ma = table.Column<float>(type: "real", nullable: true),
                    ucl_ma = table.Column<float>(type: "real", nullable: true),
                    cl_mr = table.Column<float>(type: "real", nullable: true),
                    lcl_mr = table.Column<float>(type: "real", nullable: true),
                    ucl_mr = table.Column<float>(type: "real", nullable: true),
                    cl_ms = table.Column<float>(type: "real", nullable: true),
                    lcl_ms = table.Column<float>(type: "real", nullable: true),
                    ucl_ms = table.Column<float>(type: "real", nullable: true),
                    cl_p = table.Column<float>(type: "real", nullable: true),
                    lcl_p = table.Column<float>(type: "real", nullable: true),
                    ucl_p = table.Column<float>(type: "real", nullable: true),
                    cl_np = table.Column<float>(type: "real", nullable: true),
                    lcl_np = table.Column<float>(type: "real", nullable: true),
                    ucl_np = table.Column<float>(type: "real", nullable: true),
                    cl_c = table.Column<float>(type: "real", nullable: true),
                    lcl_c = table.Column<float>(type: "real", nullable: true),
                    ucl_c = table.Column<float>(type: "real", nullable: true),
                    cl_u = table.Column<float>(type: "real", nullable: true),
                    lcl_u = table.Column<float>(type: "real", nullable: true),
                    ucl_u = table.Column<float>(type: "real", nullable: true),
                    fit_test = table.Column<int>(type: "integer", nullable: true),
                    hist_capability_sigma = table.Column<int>(type: "integer", nullable: true),
                    filter_by_ent_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_item_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_wo_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_oper_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_process_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_segment_req_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_segment_resp_id = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_spare1 = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_spare2 = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_spare3 = table.Column<bool>(type: "boolean", nullable: false),
                    filter_by_spare4 = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_characteristic", x => x.char_id);
                });

            migrationBuilder.CreateTable(
                name: "item_cons",
                columns: table => new
                {
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    shift_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    shift_start_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    fg_lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    fg_sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    reas_cd = table.Column<int>(type: "integer", nullable: true),
                    user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    item_scrapped = table.Column<bool>(type: "boolean", nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: true),
                    shift_id = table.Column<int>(type: "integer", nullable: true),
                    grade_cd = table.Column<int>(type: "integer", nullable: false),
                    status_cd = table.Column<int>(type: "integer", nullable: false),
                    from_ent_id = table.Column<int>(type: "integer", nullable: true),
                    qty_cons = table.Column<double>(type: "double precision", nullable: false),
                    qty_cons_erp = table.Column<double>(type: "double precision", nullable: false),
                    ext_ref = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    transaction_type = table.Column<int>(type: "integer", nullable: false),
                    genealogy_id = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    upstream_event_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    segment_requirement_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    segment_response_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    comments = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    created_at_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    created_at_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_item_cons", x => x.row_id);
                });

            migrationBuilder.CreateTable(
                name: "item_process_link",
                columns: table => new
                {
                    materialid = table.Column<int>(type: "integer", nullable: false),
                    process_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    item_pref = table.Column<int>(type: "integer", nullable: false),
                    status = table.Column<int>(type: "integer", maxLength: 40, nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<string>(type: "text", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_item_process_link", x => new { x.process_id, x.materialid });
                });

            migrationBuilder.CreateTable(
                name: "item_prod",
                columns: table => new
                {
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    shift_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    shift_start_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_start_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    rm_lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    rm_sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    reas_cd = table.Column<int>(type: "integer", nullable: false),
                    user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    shift_id = table.Column<int>(type: "integer", nullable: false),
                    grade_cd = table.Column<int>(type: "integer", nullable: false),
                    status_cd = table.Column<int>(type: "integer", nullable: false),
                    to_ent_id = table.Column<int>(type: "integer", nullable: true),
                    good_prod = table.Column<bool>(type: "boolean", nullable: false),
                    qty_prod = table.Column<double>(type: "double precision", nullable: false),
                    qty_prod_erp = table.Column<double>(type: "double precision", nullable: false),
                    processed_flag = table.Column<int>(type: "integer", nullable: false),
                    byproduct = table.Column<bool>(type: "boolean", nullable: false),
                    ext_ref = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    move_status = table.Column<int>(type: "integer", nullable: false),
                    genealogy_id = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    event_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    segment_requirement_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    segment_response_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    comments = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    created_at_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    created_at_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_item_prod", x => x.row_id);
                });

            migrationBuilder.CreateTable(
                name: "job",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    job_desc = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    state_cd = table.Column<int>(type: "integer", nullable: false),
                    job_priority = table.Column<int>(type: "integer", nullable: false),
                    req_finish_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    req_finish_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    init_sched_ent_id = table.Column<int>(type: "integer", nullable: false),
                    target_sched_ent_id = table.Column<int>(type: "integer", nullable: false),
                    run_ent_id = table.Column<int>(type: "integer", nullable: true),
                    qty_reqd = table.Column<double>(type: "double precision", nullable: false),
                    qty_prod = table.Column<double>(type: "double precision", nullable: false),
                    qty_prod_erp = table.Column<double>(type: "double precision", nullable: true),
                    qty_rejected = table.Column<double>(type: "double precision", nullable: false),
                    qty_rejected_erp = table.Column<double>(type: "double precision", nullable: true),
                    qty_at_start = table.Column<double>(type: "double precision", nullable: false),
                    deviation_above = table.Column<double>(type: "double precision", nullable: false),
                    deviation_below = table.Column<double>(type: "double precision", nullable: false),
                    batch_size = table.Column<double>(type: "double precision", nullable: false),
                    uom_id = table.Column<int>(type: "integer", nullable: true),
                    first_job = table.Column<bool>(type: "boolean", nullable: false),
                    final_job = table.Column<bool>(type: "boolean", nullable: false),
                    sched_pinned = table.Column<bool>(type: "boolean", nullable: false),
                    check_inv = table.Column<bool>(type: "boolean", nullable: false),
                    est_fixed_lab = table.Column<double>(type: "double precision", nullable: true),
                    est_lab_rate = table.Column<double>(type: "double precision", nullable: true),
                    est_setup_time = table.Column<double>(type: "double precision", nullable: true),
                    est_teardown_time = table.Column<double>(type: "double precision", nullable: true),
                    est_prod_rate = table.Column<double>(type: "double precision", nullable: false),
                    prod_uom = table.Column<int>(type: "integer", nullable: false),
                    est_transfer_time = table.Column<double>(type: "double precision", nullable: true),
                    sched_start_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    sched_start_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    latest_start_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    latest_start_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    sched_finish_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    sched_finish_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_start_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_start_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_finish_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_finish_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    concurrent_link = table.Column<int>(type: "integer", nullable: false),
                    job_cost = table.Column<double>(type: "double precision", nullable: true),
                    parent_contingent_job = table.Column<bool>(type: "boolean", nullable: false),
                    child_contingent_job = table.Column<bool>(type: "boolean", nullable: false),
                    notes = table.Column<string>(type: "text", nullable: true),
                    assoc_file = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    assoc_file_type = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    status_notes = table.Column<string>(type: "character varying(1700)", maxLength: 1700, nullable: true),
                    display_seq = table.Column<int>(type: "integer", nullable: false),
                    folder_ver_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    rework = table.Column<bool>(type: "boolean", nullable: false),
                    rework_cd = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    rework_process_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    edited_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    edit_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job", x => new { x.wo_id, x.oper_id });
                });

            migrationBuilder.CreateTable(
                name: "job_bom",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    seq_no = table.Column<int>(type: "integer", nullable: false),
                    bom_pos = table.Column<int>(type: "integer", nullable: false),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    reqd_grade_cd = table.Column<int>(type: "integer", nullable: true),
                    instruction = table.Column<string>(type: "text", nullable: true),
                    qty_per_parent_item = table.Column<double>(type: "double precision", nullable: false),
                    max_qty_per_parent_item = table.Column<double>(type: "double precision", nullable: true),
                    min_qty_per_parent_item = table.Column<double>(type: "double precision", nullable: true),
                    reqd_start_val = table.Column<double>(type: "double precision", nullable: false),
                    reqd_start_val_is_pct = table.Column<bool>(type: "boolean", nullable: false),
                    update_inv = table.Column<bool>(type: "boolean", nullable: false),
                    backflush = table.Column<bool>(type: "boolean", nullable: false),
                    def_reas_cd = table.Column<int>(type: "integer", nullable: true),
                    def_lot_no = table.Column<string>(type: "text", nullable: true),
                    def_sublot_no = table.Column<string>(type: "text", nullable: true),
                    def_storage_ent_id = table.Column<int>(type: "integer", nullable: true),
                    def_reject_ent_id = table.Column<int>(type: "integer", nullable: true),
                    scaling_factor = table.Column<double>(type: "double precision", nullable: true),
                    must_consume_from_inv = table.Column<bool>(type: "boolean", nullable: false),
                    may_choose_alt_inv_loc = table.Column<bool>(type: "boolean", nullable: false),
                    may_create_new_lots = table.Column<bool>(type: "boolean", nullable: false),
                    must_consume_from_wip = table.Column<bool>(type: "boolean", nullable: false),
                    must_consume_before_prod = table.Column<bool>(type: "boolean", nullable: false),
                    constant_qty = table.Column<bool>(type: "boolean", nullable: false),
                    est_time = table.Column<double>(type: "double precision", nullable: true),
                    current_subst = table.Column<int>(type: "integer", nullable: true),
                    qty_reqd = table.Column<double>(type: "double precision", nullable: true),
                    serial_no_source = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_bom", x => new { x.wo_id, x.oper_id, x.seq_no, x.bom_pos });
                });

            migrationBuilder.CreateTable(
                name: "job_bom_step",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    bom_pos = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    qty_per_parent_item = table.Column<double>(type: "double precision", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_bom_step", x => new { x.wo_id, x.oper_id, x.bom_pos, x.step_grp_id, x.step_no });
                });

            migrationBuilder.CreateTable(
                name: "job_event",
                columns: table => new
                {
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    event_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    event_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    step_no = table.Column<int>(type: "integer", nullable: true),
                    event_type = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    ent_id = table.Column<int>(type: "integer", nullable: true),
                    bom_pos = table.Column<int>(type: "integer", nullable: true),
                    lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    item_id = table.Column<int>(type: "integer", nullable: true),
                    cert_name = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    done_by_user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    checked_by_user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    source_row_id = table.Column<int>(type: "integer", nullable: true),
                    spec_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    genealogy_id = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    segment_requirement_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    segment_response_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    subsegment_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    quantity = table.Column<int>(type: "integer", nullable: true),
                    comments = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    value1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value5 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value6 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value7 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value8 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value9 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    value10 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_event", x => x.row_id);
                });

            migrationBuilder.CreateTable(
                name: "job_exec",
                columns: table => new
                {
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    job_pos = table.Column<int>(type: "integer", nullable: false),
                    next_job_only = table.Column<bool>(type: "boolean", nullable: false),
                    item_based_desc = table.Column<bool>(type: "boolean", nullable: false),
                    job_end_confirm_msg = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    def_to_ent_id = table.Column<int>(type: "integer", nullable: true),
                    def_reject_ent_id = table.Column<int>(type: "integer", nullable: true),
                    def_from_ent_id = table.Column<int>(type: "integer", nullable: true),
                    def_prod_reas_cd = table.Column<int>(type: "integer", nullable: false),
                    def_cons_reas_cd = table.Column<int>(type: "integer", nullable: true),
                    def_lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    def_sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    autoload_job_specs = table.Column<bool>(type: "boolean", nullable: false),
                    auto_seq_start_option = table.Column<int>(type: "integer", nullable: false),
                    auto_job_start_option = table.Column<int>(type: "integer", nullable: false),
                    auto_job_end_option = table.Column<int>(type: "integer", nullable: false),
                    incl_class_reas = table.Column<bool>(type: "boolean", nullable: false),
                    must_complete_steps = table.Column<bool>(type: "boolean", nullable: false),
                    must_prod_reqd_qty = table.Column<bool>(type: "boolean", nullable: false),
                    local_movable_cons_ent = table.Column<bool>(type: "boolean", nullable: false),
                    local_movable_prod_ent = table.Column<bool>(type: "boolean", nullable: false),
                    run_without_operator = table.Column<bool>(type: "boolean", nullable: false),
                    apply_post_exec_fc_counts = table.Column<bool>(type: "boolean", nullable: false),
                    suppress_start_qty_prompt = table.Column<bool>(type: "boolean", nullable: false),
                    allow_zero_qty_split = table.Column<bool>(type: "boolean", nullable: false),
                    auto_alloc_qty_to_running_job = table.Column<bool>(type: "boolean", nullable: false),
                    cur_wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    cur_oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    cur_step_no = table.Column<int>(type: "integer", nullable: true),
                    cur_step_grp_id = table.Column<int>(type: "integer", nullable: true),
                    cur_step_start = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    spare1 = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_exec", x => x.row_id);
                });

            migrationBuilder.CreateTable(
                name: "job_history",
                columns: table => new
                {
                    ent_id = table.Column<int>(type: "integer", maxLength: 40, nullable: false),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    job_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    job_start_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    job_pos = table.Column<int>(type: "integer", nullable: false),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    job_end_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    job_end_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_history", x => new { x.wo_id, x.oper_id, x.ent_id, x.job_start_utc });
                });

            migrationBuilder.CreateTable(
                name: "job_hour_history",
                columns: table => new
                {
                    ent_id = table.Column<int>(type: "integer", maxLength: 40, nullable: false),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    job_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_start_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_start_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_end_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    hour_end_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    std_prod_rate = table.Column<double>(type: "double precision", nullable: false),
                    batch_size = table.Column<double>(type: "double precision", nullable: false),
                    qty_good = table.Column<double>(type: "double precision", nullable: false),
                    qty_reject = table.Column<double>(type: "double precision", nullable: false),
                    runtime = table.Column<double>(type: "double precision", nullable: false),
                    downtime = table.Column<double>(type: "double precision", nullable: false),
                    idletime = table.Column<double>(type: "double precision", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_at = table.Column<string>(type: "text", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_hour_history", x => new { x.wo_id, x.oper_id, x.ent_id, x.job_start_utc, x.hour_start_utc });
                });

            migrationBuilder.CreateTable(
                name: "job_route",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    input_oper_id = table.Column<string>(type: "text", nullable: false),
                    input_percent = table.Column<double>(type: "double precision", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_route", x => new { x.wo_id, x.oper_id, x.input_oper_id });
                });

            migrationBuilder.CreateTable(
                name: "job_state",
                columns: table => new
                {
                    state_cd = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    state_desc = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    color = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_state", x => x.state_cd);
                });

            migrationBuilder.CreateTable(
                name: "job_step",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    seq_no = table.Column<int>(type: "integer", nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_seq = table.Column<int>(type: "integer", nullable: false),
                    step_name = table.Column<string>(type: "text", nullable: true),
                    step_desc = table.Column<string>(type: "text", nullable: false),
                    action_type = table.Column<int>(type: "integer", nullable: false),
                    std_time = table.Column<double>(type: "double precision", nullable: false),
                    complete_cond = table.Column<int>(type: "integer", nullable: false),
                    allow_bypass = table.Column<bool>(type: "boolean", nullable: false),
                    enter_data = table.Column<bool>(type: "boolean", nullable: false),
                    spc_char = table.Column<string>(type: "text", nullable: true),
                    form_name = table.Column<string>(type: "text", nullable: true),
                    data_log_grp_id = table.Column<int>(type: "integer", nullable: true),
                    reqd_rep = table.Column<int>(type: "integer", nullable: false),
                    control_type = table.Column<int>(type: "integer", nullable: false),
                    high_limit = table.Column<double>(type: "double precision", nullable: true),
                    low_limit = table.Column<double>(type: "double precision", nullable: true),
                    limit_warning = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    spare5 = table.Column<string>(type: "text", nullable: true),
                    spare6 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_step", x => new { x.wo_id, x.oper_id, x.seq_no, x.step_no, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "job_step_data",
                columns: table => new
                {
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    lot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    sublot_no = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    state_cd = table.Column<int>(type: "integer", nullable: false),
                    act_start_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_start_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_finish_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    act_finish_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    step_data = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    step_data_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    step_data_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    start_user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    finish_user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    data_user_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    form_done = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare5 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare6 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_step_data", x => x.row_id);
                });

            migrationBuilder.CreateTable(
                name: "job_step_grp",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    seq_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_grp_desc = table.Column<string>(type: "text", nullable: false),
                    step_grp_seq = table.Column<int>(type: "integer", nullable: false),
                    repeatability = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_job_step_grp", x => new { x.wo_id, x.oper_id, x.seq_no, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "material",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    materialclassid = table.Column<int>(type: "integer", nullable: false),
                    materialclassname = table.Column<string>(type: "text", nullable: false),
                    materialclasstypeid = table.Column<int>(type: "integer", nullable: false),
                    materialclasstypename = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    measuringunitid = table.Column<int>(type: "integer", nullable: false),
                    measuringunitname = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    precisionplace = table.Column<int>(type: "integer", nullable: false),
                    specification = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    produtionunitid = table.Column<int>(type: "integer", nullable: true),
                    produtionunitname = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    remark = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_material", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "materialbom",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    version = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    remark = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_materialbom", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "materialbommateriallink",
                columns: table => new
                {
                    materialbomid = table.Column<int>(type: "integer", nullable: false),
                    materialid = table.Column<int>(type: "integer", nullable: false),
                    materialnumber = table.Column<double>(type: "double precision", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_materialbommateriallink", x => new { x.materialid, x.materialbomid });
                });

            migrationBuilder.CreateTable(
                name: "materialclass",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    typeid = table.Column<int>(type: "integer", nullable: false),
                    typename = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_materialclass", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "materialclasstype",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    type = table.Column<string>(type: "text", nullable: false),
                    description = table.Column<string>(type: "text", nullable: false),
                    note = table.Column<string>(type: "text", nullable: true),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_materialclasstype", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "materialmaterialbomlink",
                columns: table => new
                {
                    materialid = table.Column<int>(type: "integer", nullable: false),
                    materialbomid = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_materialmaterialbomlink", x => new { x.materialid, x.materialbomid });
                });

            migrationBuilder.CreateTable(
                name: "measuringunit",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    unitname = table.Column<string>(type: "text", nullable: false),
                    unitcode = table.Column<string>(type: "text", nullable: false),
                    unittype = table.Column<int>(type: "integer", nullable: false),
                    type = table.Column<string>(type: "text", nullable: false),
                    abbreviation = table.Column<string>(type: "text", nullable: false),
                    conversionunit = table.Column<int>(type: "integer", nullable: false),
                    unit = table.Column<string>(type: "text", nullable: false),
                    ratio = table.Column<string>(type: "text", nullable: false),
                    note = table.Column<string>(type: "text", nullable: true),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_measuringunit", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "measuringunittype",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    type = table.Column<string>(type: "text", nullable: false),
                    code = table.Column<string>(type: "text", nullable: false),
                    note = table.Column<string>(type: "text", nullable: true),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_measuringunittype", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "oper",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    oper_desc = table.Column<string>(type: "text", nullable: true),
                    def_reject_rate = table.Column<double>(type: "double precision", nullable: true),
                    first_oper = table.Column<bool>(type: "boolean", nullable: false),
                    final_oper = table.Column<bool>(type: "boolean", nullable: false),
                    display_seq = table.Column<int>(type: "integer", nullable: false),
                    check_inv = table.Column<bool>(type: "boolean", nullable: false),
                    sched_to_ent_id = table.Column<int>(type: "integer", nullable: true),
                    oper_type = table.Column<string>(type: "text", nullable: true),
                    oper_cost = table.Column<double>(type: "double precision", nullable: true),
                    deviation_above = table.Column<double>(type: "double precision", nullable: false),
                    deviation_below = table.Column<double>(type: "double precision", nullable: false),
                    assoc_file = table.Column<string>(type: "text", nullable: true),
                    assoc_file_type = table.Column<string>(type: "text", nullable: true),
                    rework_cd = table.Column<string>(type: "text", nullable: true),
                    notes = table.Column<string>(type: "text", nullable: true),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper", x => new { x.process_id, x.oper_id });
                });

            migrationBuilder.CreateTable(
                name: "oper_attr",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    attr_id = table.Column<int>(type: "integer", nullable: false),
                    attr_value = table.Column<string>(type: "text", nullable: true),
                    notes = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper_attr", x => new { x.process_id, x.oper_id, x.attr_id });
                });

            migrationBuilder.CreateTable(
                name: "oper_ent_link",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    est_fixed_lab = table.Column<double>(type: "double precision", nullable: true),
                    est_lab_rate = table.Column<double>(type: "double precision", nullable: true),
                    est_setup_time = table.Column<double>(type: "double precision", nullable: true),
                    est_teardown_time = table.Column<double>(type: "double precision", nullable: true),
                    est_prod_rate = table.Column<double>(type: "double precision", nullable: false),
                    prod_uom = table.Column<int>(type: "integer", nullable: false),
                    batch_size = table.Column<double>(type: "double precision", nullable: false),
                    est_transfer_time = table.Column<double>(type: "double precision", nullable: true),
                    init_prod_pct = table.Column<double>(type: "double precision", nullable: true),
                    parent_contingent_ent = table.Column<bool>(type: "boolean", nullable: false),
                    child_contingent_ent = table.Column<bool>(type: "boolean", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper_ent_link", x => new { x.process_id, x.oper_id, x.ent_id });
                });

            migrationBuilder.CreateTable(
                name: "oper_ent_route",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    input_oper_id = table.Column<string>(type: "text", nullable: false),
                    input_ent_id = table.Column<int>(type: "integer", nullable: false),
                    input_percent = table.Column<double>(type: "double precision", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper_ent_route", x => new { x.process_id, x.oper_id, x.ent_id, x.input_oper_id, x.input_ent_id });
                });

            migrationBuilder.CreateTable(
                name: "oper_step",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_seq = table.Column<int>(type: "integer", nullable: false),
                    step_name = table.Column<string>(type: "text", nullable: true),
                    step_desc = table.Column<string>(type: "text", nullable: false),
                    action_type = table.Column<int>(type: "integer", nullable: false),
                    std_time = table.Column<double>(type: "double precision", nullable: false),
                    complete_cond = table.Column<int>(type: "integer", nullable: false),
                    allow_bypass = table.Column<bool>(type: "boolean", nullable: false),
                    enter_data = table.Column<bool>(type: "boolean", nullable: false),
                    spc_char = table.Column<string>(type: "text", nullable: true),
                    form_name = table.Column<string>(type: "text", nullable: true),
                    data_log_grp_id = table.Column<int>(type: "integer", nullable: true),
                    reqd_rep_pct = table.Column<double>(type: "double precision", nullable: false),
                    control_type = table.Column<int>(type: "integer", nullable: false),
                    high_limit = table.Column<double>(type: "double precision", nullable: true),
                    low_limit = table.Column<double>(type: "double precision", nullable: true),
                    limit_warning = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    spare5 = table.Column<string>(type: "text", nullable: true),
                    spare6 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper_step", x => new { x.process_id, x.oper_id, x.step_no, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "oper_step_grp",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "text", nullable: false),
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_grp_desc = table.Column<string>(type: "text", nullable: false),
                    step_grp_seq = table.Column<int>(type: "integer", nullable: false),
                    repeatability = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_oper_step_grp", x => new { x.process_id, x.oper_id, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "process",
                columns: table => new
                {
                    process_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    process_class_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    process_ver_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    process_desc = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    process_level = table.Column<int>(type: "integer", nullable: false),
                    process_status = table.Column<int>(type: "integer", nullable: false),
                    creator = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    approver = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    created_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    last_user_to_change_status = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_status_change_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    checked_out_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_instantiated = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    disassembly = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    may_override_route = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    rework = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    notes = table.Column<string>(type: "text", nullable: false),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
                    last_editor = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_process", x => x.process_id);
                });

            migrationBuilder.CreateTable(
                name: "processroute",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    remark = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_processroute", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "productionunit",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    productionunitname = table.Column<string>(type: "text", nullable: false),
                    productionunitcode = table.Column<string>(type: "text", nullable: false),
                    productionunittypeid = table.Column<int>(type: "integer", nullable: false),
                    productionunittype = table.Column<string>(type: "text", nullable: false),
                    parentproductionunitid = table.Column<int>(type: "integer", nullable: false),
                    parentproductionunit = table.Column<string>(type: "text", nullable: true),
                    enabled = table.Column<bool>(type: "boolean", nullable: false),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_productionunit", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "productionunittype",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    type = table.Column<string>(type: "text", nullable: false),
                    description = table.Column<string>(type: "text", nullable: false),
                    note = table.Column<string>(type: "text", nullable: true),
                    createtime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    updatetime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    isdeleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("pk_productionunittype", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "qm_spec_rule_link",
                columns: table => new
                {
                    qm_spec_id = table.Column<int>(type: "integer", nullable: false),
                    rule_id = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_qm_spec_rule_link", x => new { x.qm_spec_id, x.rule_id });
                });

            migrationBuilder.CreateTable(
                name: "sample_freq",
                columns: table => new
                {
                    freq_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    freq_name = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    freq_desc = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    freq_type = table.Column<int>(type: "integer", nullable: false, defaultValue: 1),
                    interval = table.Column<float>(type: "real", nullable: true),
                    interval_unit = table.Column<int>(type: "integer", nullable: true),
                    prod_reset_option = table.Column<int>(type: "integer", nullable: true),
                    offset_start = table.Column<int>(type: "integer", nullable: true),
                    offset_start_unit = table.Column<int>(type: "integer", nullable: true),
                    offset_end = table.Column<int>(type: "integer", nullable: true),
                    offset_end_unit = table.Column<int>(type: "integer", nullable: true),
                    samples_per_shift = table.Column<int>(type: "integer", nullable: true),
                    multiplier = table.Column<int>(type: "integer", nullable: false, defaultValue: 1),
                    enabled = table.Column<bool>(type: "boolean", nullable: false),
                    expiry_time = table.Column<int>(type: "integer", nullable: true),
                    expiry_unit = table.Column<int>(type: "integer", nullable: true),
                    warning_time = table.Column<int>(type: "integer", nullable: true, defaultValue: 5),
                    warning_unit = table.Column<int>(type: "integer", nullable: false, defaultValue: 1),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sample_freq", x => x.freq_id);
                });

            migrationBuilder.CreateTable(
                name: "sample_plan",
                columns: table => new
                {
                    plan_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    plan_name = table.Column<string>(type: "text", nullable: false),
                    plan_desc = table.Column<string>(type: "text", nullable: true),
                    category_id = table.Column<int>(type: "integer", nullable: true),
                    verified_write = table.Column<bool>(type: "boolean", nullable: false),
                    sample_name = table.Column<string>(type: "text", nullable: false),
                    reset_option = table.Column<int>(type: "integer", nullable: false),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sample_plan", x => x.plan_id);
                });

            migrationBuilder.CreateTable(
                name: "sample_plan_freq_link",
                columns: table => new
                {
                    plan_id = table.Column<int>(type: "integer", nullable: false),
                    freq_id = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sample_plan_freq_link", x => new { x.plan_id, x.freq_id });
                });

            migrationBuilder.CreateTable(
                name: "spc_rule",
                columns: table => new
                {
                    rule_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    rule_desc = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    use_for_ix = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_mr = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_xbar = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_range = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_sigma = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_ma = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_ewmaix = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_run = table.Column<bool>(type: "boolean", nullable: false),
                    use_for_attr = table.Column<bool>(type: "boolean", nullable: false),
                    test1 = table.Column<int>(type: "integer", nullable: true),
                    test2 = table.Column<int>(type: "integer", nullable: true),
                    and_not_or = table.Column<bool>(type: "boolean", nullable: false),
                    level1 = table.Column<float>(type: "real", nullable: true),
                    level2 = table.Column<float>(type: "real", nullable: true),
                    num_points = table.Column<int>(type: "integer", nullable: false),
                    of_points = table.Column<int>(type: "integer", nullable: false),
                    priority = table.Column<int>(type: "integer", nullable: false),
                    obsolete = table.Column<bool>(type: "boolean", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    created_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    created_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_spc_rule", x => x.rule_id);
                });

            migrationBuilder.CreateTable(
                name: "std_oper",
                columns: table => new
                {
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    oper_desc = table.Column<string>(type: "text", nullable: true),
                    def_reject_rate = table.Column<double>(type: "double precision", nullable: true),
                    check_inv = table.Column<bool>(type: "boolean", nullable: false),
                    sched_to_ent_id = table.Column<int>(type: "integer", nullable: true),
                    oper_type = table.Column<string>(type: "text", nullable: true),
                    oper_cost = table.Column<double>(type: "double precision", nullable: true),
                    deviation_above = table.Column<double>(type: "double precision", nullable: false),
                    deviation_below = table.Column<double>(type: "double precision", nullable: false),
                    assoc_file = table.Column<string>(type: "text", nullable: true),
                    assoc_file_type = table.Column<string>(type: "text", nullable: true),
                    notes = table.Column<string>(type: "text", nullable: true),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_std_oper", x => x.oper_id);
                });

            migrationBuilder.CreateTable(
                name: "std_oper_attr",
                columns: table => new
                {
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    attr_id = table.Column<int>(type: "integer", nullable: false),
                    attr_value = table.Column<string>(type: "text", nullable: true),
                    notes = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_std_oper_attr", x => new { x.oper_id, x.attr_id });
                });

            migrationBuilder.CreateTable(
                name: "std_oper_ent_link",
                columns: table => new
                {
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    est_fixed_lab = table.Column<double>(type: "double precision", nullable: true),
                    est_lab_rate = table.Column<double>(type: "double precision", nullable: true),
                    est_setup_time = table.Column<double>(type: "double precision", nullable: true),
                    est_teardown_time = table.Column<double>(type: "double precision", nullable: true),
                    est_prod_rate = table.Column<double>(type: "double precision", nullable: false),
                    prod_uom = table.Column<int>(type: "integer", nullable: false),
                    batch_size = table.Column<double>(type: "double precision", nullable: false),
                    est_transfer_time = table.Column<double>(type: "double precision", nullable: true),
                    init_prod_pct = table.Column<double>(type: "double precision", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_std_oper_ent_link", x => new { x.oper_id, x.ent_id });
                });

            migrationBuilder.CreateTable(
                name: "std_oper_step",
                columns: table => new
                {
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    step_no = table.Column<int>(type: "integer", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_seq = table.Column<int>(type: "integer", nullable: false),
                    step_name = table.Column<string>(type: "text", nullable: true),
                    step_desc = table.Column<string>(type: "text", nullable: false),
                    action_type = table.Column<int>(type: "integer", nullable: false),
                    std_time = table.Column<double>(type: "double precision", nullable: false),
                    complete_cond = table.Column<int>(type: "integer", nullable: false),
                    allow_bypass = table.Column<bool>(type: "boolean", nullable: false),
                    enter_data = table.Column<bool>(type: "boolean", nullable: false),
                    spc_char = table.Column<string>(type: "text", nullable: true),
                    form_name = table.Column<string>(type: "text", nullable: true),
                    data_log_grp_id = table.Column<int>(type: "integer", nullable: true),
                    reqd_rep_pct = table.Column<double>(type: "double precision", nullable: false),
                    control_type = table.Column<int>(type: "integer", nullable: false),
                    high_limit = table.Column<double>(type: "double precision", nullable: true),
                    low_limit = table.Column<double>(type: "double precision", nullable: true),
                    limit_warning = table.Column<bool>(type: "boolean", nullable: false),
                    spare1 = table.Column<string>(type: "text", nullable: true),
                    spare2 = table.Column<string>(type: "text", nullable: true),
                    spare3 = table.Column<string>(type: "text", nullable: true),
                    spare4 = table.Column<string>(type: "text", nullable: true),
                    spare5 = table.Column<string>(type: "text", nullable: true),
                    spare6 = table.Column<string>(type: "text", nullable: true),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_std_oper_step", x => new { x.oper_id, x.step_no, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "std_oper_step_grp",
                columns: table => new
                {
                    oper_id = table.Column<string>(type: "text", nullable: false),
                    step_grp_id = table.Column<int>(type: "integer", nullable: false),
                    step_grp_desc = table.Column<string>(type: "text", nullable: false),
                    step_grp_seq = table.Column<int>(type: "integer", nullable: false),
                    repeatability = table.Column<int>(type: "integer", nullable: false),
                    last_edit_comment = table.Column<string>(type: "text", nullable: true),
                    last_edit_by = table.Column<string>(type: "text", nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_std_oper_step_grp", x => new { x.oper_id, x.step_grp_id });
                });

            migrationBuilder.CreateTable(
                name: "stdoper_ent_route",
                columns: table => new
                {
                    process_route_id = table.Column<int>(type: "integer", nullable: false),
                    oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    ent_id = table.Column<int>(type: "integer", nullable: false),
                    input_oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    input_ent_id = table.Column<int>(type: "integer", nullable: false),
                    input_percent = table.Column<float>(type: "real", nullable: false),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    order = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_stdoper_ent_route", x => new { x.process_route_id, x.oper_id, x.ent_id, x.input_oper_id, x.input_ent_id });
                });

            migrationBuilder.CreateTable(
                name: "wo",
                columns: table => new
                {
                    wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    wo_desc = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    process_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    bom_ver_id = table.Column<string>(type: "text", nullable: true),
                    spec_ver_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    item_id = table.Column<int>(type: "integer", nullable: false),
                    start_qty = table.Column<double>(type: "double precision", nullable: false),
                    req_qty = table.Column<double>(type: "double precision", nullable: false),
                    release_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    release_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    req_finish_time_utc = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    req_finish_time_local = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    state_cd = table.Column<int>(type: "integer", nullable: false),
                    wo_priority = table.Column<int>(type: "integer", nullable: false),
                    cust_info = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    mo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    production_schedule_id = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    notes = table.Column<string>(type: "text", nullable: true),
                    not_deletable = table.Column<bool>(type: "boolean", nullable: false),
                    disassembly = table.Column<bool>(type: "boolean", nullable: false),
                    may_override_route = table.Column<bool>(type: "boolean", nullable: false),
                    override_serialization = table.Column<bool>(type: "boolean", nullable: false),
                    input_wo_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    input_oper_id = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    input_seq_no = table.Column<int>(type: "integer", nullable: true),
                    target_sched_line_id = table.Column<int>(type: "integer", nullable: true),
                    queue_seq_no = table.Column<int>(type: "integer", nullable: true),
                    spare1 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare2 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare3 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    spare4 = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: true),
                    last_edit_comment = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: true),
                    last_edit_by = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true),
                    last_edit_at = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    mod_id = table.Column<long>(type: "bigint", nullable: false),
                    row_id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:IdentitySequenceOptions", "'0', '1', '0', '', 'False', '1'")
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wo", x => x.wo_id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "attr");

            migrationBuilder.DropTable(
                name: "bom_item_oper_link");

            migrationBuilder.DropTable(
                name: "bom_item_oper_step_link");

            migrationBuilder.DropTable(
                name: "characteristic");

            migrationBuilder.DropTable(
                name: "item_cons");

            migrationBuilder.DropTable(
                name: "item_process_link");

            migrationBuilder.DropTable(
                name: "item_prod");

            migrationBuilder.DropTable(
                name: "job");

            migrationBuilder.DropTable(
                name: "job_bom");

            migrationBuilder.DropTable(
                name: "job_bom_step");

            migrationBuilder.DropTable(
                name: "job_event");

            migrationBuilder.DropTable(
                name: "job_exec");

            migrationBuilder.DropTable(
                name: "job_history");

            migrationBuilder.DropTable(
                name: "job_hour_history");

            migrationBuilder.DropTable(
                name: "job_route");

            migrationBuilder.DropTable(
                name: "job_state");

            migrationBuilder.DropTable(
                name: "job_step");

            migrationBuilder.DropTable(
                name: "job_step_data");

            migrationBuilder.DropTable(
                name: "job_step_grp");

            migrationBuilder.DropTable(
                name: "material");

            migrationBuilder.DropTable(
                name: "materialbom");

            migrationBuilder.DropTable(
                name: "materialbommateriallink");

            migrationBuilder.DropTable(
                name: "materialclass");

            migrationBuilder.DropTable(
                name: "materialclasstype");

            migrationBuilder.DropTable(
                name: "materialmaterialbomlink");

            migrationBuilder.DropTable(
                name: "measuringunit");

            migrationBuilder.DropTable(
                name: "measuringunittype");

            migrationBuilder.DropTable(
                name: "oper");

            migrationBuilder.DropTable(
                name: "oper_attr");

            migrationBuilder.DropTable(
                name: "oper_ent_link");

            migrationBuilder.DropTable(
                name: "oper_ent_route");

            migrationBuilder.DropTable(
                name: "oper_step");

            migrationBuilder.DropTable(
                name: "oper_step_grp");

            migrationBuilder.DropTable(
                name: "process");

            migrationBuilder.DropTable(
                name: "processroute");

            migrationBuilder.DropTable(
                name: "productionunit");

            migrationBuilder.DropTable(
                name: "productionunittype");

            migrationBuilder.DropTable(
                name: "qm_spec_rule_link");

            migrationBuilder.DropTable(
                name: "sample_freq");

            migrationBuilder.DropTable(
                name: "sample_plan");

            migrationBuilder.DropTable(
                name: "sample_plan_freq_link");

            migrationBuilder.DropTable(
                name: "spc_rule");

            migrationBuilder.DropTable(
                name: "std_oper");

            migrationBuilder.DropTable(
                name: "std_oper_attr");

            migrationBuilder.DropTable(
                name: "std_oper_ent_link");

            migrationBuilder.DropTable(
                name: "std_oper_step");

            migrationBuilder.DropTable(
                name: "std_oper_step_grp");

            migrationBuilder.DropTable(
                name: "stdoper_ent_route");

            migrationBuilder.DropTable(
                name: "wo");
        }
    }
}
